--[[
@classmod Marker
General map annotation, exported in a .map file
]]

return pl.class {
	_name = "Marker",
	_init = function (self, name, x, y, color)
		self.name, self.x, self.y, self.color = name, x, y, color
		self.show = {text = false, outline = true}
	end,
	
	get_name = function (self)
		return string.match(self.name, "(%a+)%(*(%d*)%)*")
	end,
	
	update = function (self)
		
	end,
	
	draw = function (self)
		if Sled.state == "focused" then
			self.show.text = false
		else
			self.show.text = true
		end
			_lg.setColor(1, 1, 1)
		if self.show.outline then
			_lg.setColor(.5, 1, 1)
			_lg.rectangle('line', self.x, self.y, Sled.tile_size, Sled.tile_size)
		end
		if Sled.cursor.x == self.x and Sled.cursor.y == self.y and self.show.text then
			_lg.setColor(1, 1, 1)
			_lg.print(self.name, self.x, self.y-2, 0, .5, .5)
		end
	end,
}
